package com.adz.robotdemo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.adz.robotdemo.R;

/**
 * Created by Administrator on 2017/6/12.
 */

public class LVAdapter extends BaseAdapter {

    Context mContext;
    LayoutInflater inflater;
    private String[] question={
            "如何选择商铺的风格?",
            "为什么验证码输入不了?",
            "为什么我的注册信息一直审核不通过?",
            "什么是商铺认领?",
            "认领商铺需要提供什么证件资料？",
            "认领商铺审核多长时间？",
            "一个人可以认领多家商铺吗？",
            "为什么我的申请认领不成功？",
            "认领后，在哪里管理我的商铺？",
            "认领商铺，有什么好处？",
            "认领商铺后，如何管理我的商铺？",
            "个体用户如何填写公司名"
    };

    public LVAdapter(Context mContext) {
        this.mContext = mContext;
        inflater= LayoutInflater.from(mContext);
    }

    @Override
    public int getCount() {
        return question.length;
    }

    @Override
    public Object getItem(int i) {
        return question[i];
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder = null;
        if (view == null){
            viewHolder = new ViewHolder();
            view=inflater.inflate(R.layout.layout_item,null);
            viewHolder.name= (TextView) view.findViewById(R.id.tv);
            view.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) view.getTag();
        }
        viewHolder.name.setText(question[i]);
        return view;
    }


    private class ViewHolder {
        public TextView name;
    }
}
